<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wwwApp: tasks.php File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">wwwApp
   </div>
   <div id="projectbrief">A web app for workshop organizing, recruitment and qualification</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">tasks.php File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><a href="tasks_8php_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a5330df836d593c05befda9913a6acc23"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#a5330df836d593c05befda9913a6acc23">buildTaskList</a> ($wid)</td></tr>
<tr class="memitem:a62087fcd8a268c3b4a89b47ac6212e51"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#a62087fcd8a268c3b4a89b47ac6212e51">actionCreateTask</a> ($wid)</td></tr>
<tr class="memitem:a1bb56aca229089027f3284499c75d35b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#a1bb56aca229089027f3284499c75d35b">actionEditTask</a> ($wid, $tid, $new=false)</td></tr>
<tr class="memitem:a7a00a0a7a516a918ae7fc06e450317b8"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#a7a00a0a7a516a918ae7fc06e450317b8">actionDeleteTask</a> ($wid, $tid, $confirmed=false)</td></tr>
<tr class="memitem:a712580cf1eed0682188283f6b791c062"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#a712580cf1eed0682188283f6b791c062">actionEditSolution</a> ($wid, $tid)</td></tr>
<tr class="memitem:ae1f5d73a5ddf78d15aa18706f9786b14"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#ae1f5d73a5ddf78d15aa18706f9786b14">buildParticipantList</a> ($wid)</td></tr>
<tr class="memitem:a2e198636405f0e355af142a92bb6c6d3"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#a2e198636405f0e355af142a92bb6c6d3">actionShowPointsTable</a> ()</td></tr>
<tr class="memitem:ae7b40cdb225277c914608d27f4d75a2e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#ae7b40cdb225277c914608d27f4d75a2e">actionEditTasksComment</a> ($wid)</td></tr>
<tr class="memitem:aca06f86abe442189d96a3f04ad123a8c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#aca06f86abe442189d96a3f04ad123a8c">actionShowTaskSolutions</a> ($wid, $uid)</td></tr>
<tr class="memitem:ab8d5828db2f54803fb162dfdf44f15de"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#ab8d5828db2f54803fb162dfdf44f15de">actionEditSolutionsGradeForm</a> ($wid, $uid, $tid, $submitted)</td></tr>
<tr class="memitem:a17b2ff0082f478470dc8ca4d28b6568f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tasks_8php.html#a17b2ff0082f478470dc8ca4d28b6568f">checkUserCanEditTasks</a> ($wid)</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a62087fcd8a268c3b4a89b47ac6212e51"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionCreateTask </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00077">77</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $DB-&gt;query(<span class="stringliteral">&#39;SELECT MAX(tid) FROM table_tasks WHERE wid=$1&#39;</span>, $wid);</div>
<div class="line">        $tid = intval($DB-&gt;fetch())+1;</div>
<div class="line">        <a class="code" href="tasks_8php.html#a1bb56aca229089027f3284499c75d35b">actionEditTask</a>($wid, $tid, <span class="keyword">true</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a7a00a0a7a516a918ae7fc06e450317b8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionDeleteTask </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$tid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$confirmed</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00138">138</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $tid = intval($tid);</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers) || !<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!$confirmed)</div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Are you sure you want to delete the following task?&#39;</span>). <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>.</div>
<div class="line">                        <span class="stringliteral">&#39;&lt;a class=&quot;button&quot; href=&quot;deleteTask(&#39;</span>. $wid .<span class="charliteral">&#39;;&#39;</span>. $tid .<span class="stringliteral">&#39;;true)&quot;&gt;&#39;</span>. _(<span class="stringliteral">&#39;Yes&#39;</span>) .<span class="stringliteral">&#39;&lt;/a&gt; &#39;</span>.</div>
<div class="line">                        <span class="stringliteral">&#39;&lt;a class=&quot;button&quot; href=&quot;showWorkshopTasks(&#39;</span>. $wid .<span class="stringliteral">&#39;)&quot;&gt;&#39;</span>. _(<span class="stringliteral">&#39;Cancel&#39;</span>) .<span class="stringliteral">&#39;&lt;/a&gt;&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;warning&#39;</span>);</div>
<div class="line">                 $PAGE-&gt;title = _(<span class="stringliteral">&#39;Task deletion&#39;</span>);</div>
<div class="line">                 $description = $DB-&gt;tasks($wid,$tid)-&gt;get(<span class="stringliteral">&#39;description&#39;</span>);</div>
<div class="line">                 echo <span class="stringliteral">&#39;&lt;div class=&quot;contentBox&quot;&gt;&#39;</span>. <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($description) .<span class="stringliteral">&#39;&lt;/div&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $DB-&gt;tasks($wid,$tid)-&gt;delete();</div>
<div class="line">                $PAGE-&gt;addMessage(sprintf(_(<span class="stringliteral">&#39;Task %d. deleted.&#39;</span>), $tid), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;task delete&#39;</span>, $wid);</div>
<div class="line">                <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;showWorkshopTasks&#39;</span>, array($wid));</div>
<div class="line">        }</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a712580cf1eed0682188283f6b791c062"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditSolution </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$tid</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00166">166</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $tid = intval($tid);</div>
<div class="line"></div>
<div class="line">        $participant = $DB-&gt;workshop_users($wid, $USER[<span class="stringliteral">&#39;uid&#39;</span>])-&gt;get(<span class="stringliteral">&#39;participant&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (!$participant)  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        $isCandidate = ($participant == <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;candidate&#39;</span>)-&gt;id);</div>
<div class="line"></div>
<div class="line">        $task = $DB-&gt;tasks($wid, $tid)-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (!$task)  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(sprintf(_(<span class="stringliteral">&#39;Invalid task id: #%d (workshop #%d).&#39;</span>), $tid, $wid));</div>
<div class="line">        $DB-&gt;query(<span class="stringliteral">&#39;SELECT * FROM table_task_solutions</span></div>
<div class="line"><span class="stringliteral">                WHERE wid=$1 AND tid=$2 AND uid=$3</span></div>
<div class="line"><span class="stringliteral">                ORDER BY submitted DESC&#39;</span>,</div>
<div class="line">                $wid, $tid, $USER[<span class="stringliteral">&#39;uid&#39;</span>]</div>
<div class="line">        );</div>
<div class="line">        $solutions = $DB-&gt;fetch_all();</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!is_array($solutions) || empty($solutions))</div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;title = _(<span class="stringliteral">&#39;Task solution&#39;</span>);</div>
<div class="line">                $data = array(</div>
<div class="line">                        <span class="stringliteral">&#39;wid&#39;</span> =&gt; $wid,</div>
<div class="line">                        <span class="stringliteral">&#39;tid&#39;</span> =&gt; $tid,</div>
<div class="line">                        <span class="stringliteral">&#39;uid&#39;</span> =&gt; $USER[<span class="stringliteral">&#39;uid&#39;</span>],</div>
<div class="line">                        <span class="stringliteral">&#39;submitted&#39;</span> =&gt; time(),</div>
<div class="line">                        <span class="stringliteral">&#39;solution&#39;</span> =&gt; NULL,</div>
<div class="line">                        <span class="stringliteral">&#39;grade&#39;</span> =&gt; NULL,</div>
<div class="line">                        <span class="stringliteral">&#39;feedback&#39;</span> =&gt; NULL,</div>
<div class="line">                        <span class="stringliteral">&#39;comment&#39;</span> =&gt; NULL</div>
<div class="line">                );</div>
<div class="line">                $feedback = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;title = _(<span class="stringliteral">&#39;Edit your solution&#39;</span>);</div>
<div class="line">                $data = $solutions[0];</div>
<div class="line">                $feedback = _(<span class="stringliteral">&#39;status&#39;</span>) .<span class="stringliteral">&#39;: &#39;</span>.  EnumSolutionStatus($solutions[0][<span class="stringliteral">&#39;status&#39;</span>])-&gt;description .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">                <span class="keywordflow">if</span> (!empty($solutions[0][<span class="stringliteral">&#39;grade&#39;</span>]))</div>
<div class="line">                        $feedback .= _(<span class="stringliteral">&#39;grade&#39;</span>) .<span class="stringliteral">&#39;: &#39;</span>. htmlspecialchars($solutions[0][<span class="stringliteral">&#39;grade&#39;</span>]) .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">                <span class="keywordflow">if</span> (!empty($solutions[0][<span class="stringliteral">&#39;feedback&#39;</span>]))</div>
<div class="line">                        $feedback .= _(<span class="stringliteral">&#39;comment&#39;</span>) .<span class="stringliteral">&#39;: &lt;div class=&quot;descriptionBox&quot;&gt;&#39;</span>. htmlspecialchars($solutions[0][<span class="stringliteral">&#39;feedback&#39;</span>]) .<span class="stringliteral">&#39;&lt;/div&gt;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;a class=&quot;back&quot; href=&quot;showWorkshopTasks(&#39;</span>. $wid .<span class="stringliteral">&#39;)&quot;&gt;&#39;</span>. _(<span class="stringliteral">&#39;back&#39;</span>) .<span class="stringliteral">&#39;&lt;/a&gt;&#39;</span>;</div>
<div class="line">        echo sprintf(_(<span class="stringliteral">&#39;Task %d. from %s&#39;</span>), $tid,  <span class="stringliteral">&#39;&lt;b&gt;&#39;</span>. $DB-&gt;workshops[$wid]-&gt;get(<span class="stringliteral">&#39;title&#39;</span>) .<span class="stringliteral">&#39;&lt;/b&gt;&#39;</span>) .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;div class=&quot;descriptionBox&quot;&gt;&#39;</span>. <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($task[<span class="stringliteral">&#39;description&#39;</span>]) .<span class="stringliteral">&#39;&lt;/div&gt;&#39;</span>;</div>
<div class="line">        echo $feedback;</div>
<div class="line">        <span class="keywordflow">if</span> (!$isCandidate)</div>
<div class="line">                <span class="keywordflow">return</span> print _(<span class="stringliteral">&#39;solution&#39;</span>) .<span class="stringliteral">&#39; &lt;div class=&quot;descriptionBox&quot;&gt;&#39;</span>. $data[<span class="stringliteral">&#39;solution&#39;</span>] .<span class="stringliteral">&#39;&lt;/div&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME     =&gt; TYPE;         tDESCRIPTION;</span></div>
<div class="line"><span class="stringliteral">                solution =&gt; richtextarea; solution;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;solution&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>] .= <span class="stringliteral">&#39; &amp;nbsp; &lt;small&gt;(&#39;</span>. _(<span class="stringliteral">&#39;The editor allows you to attach files.&#39;</span>) .<span class="stringliteral">&#39;)&lt;/small&gt;&#39;</span>;</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line">        $form-&gt;values = $data;</div>
<div class="line">        <span class="keywordflow">if</span> (!$form-&gt;submitted())</div>
<div class="line">                <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line">        $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">        <span class="keywordflow">if</span> (!$form-&gt;valid)</div>
<div class="line">                <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line"></div>
<div class="line">        $DB-&gt;task_solutions[] = array(</div>
<div class="line">                <span class="stringliteral">&#39;wid&#39;</span> =&gt; $wid,</div>
<div class="line">                <span class="stringliteral">&#39;tid&#39;</span> =&gt; $tid,</div>
<div class="line">                <span class="stringliteral">&#39;uid&#39;</span> =&gt; $USER[<span class="stringliteral">&#39;uid&#39;</span>],</div>
<div class="line">                <span class="stringliteral">&#39;submitted&#39;</span> =&gt; time(),</div>
<div class="line">                <span class="stringliteral">&#39;solution&#39;</span> =&gt; $values[<span class="stringliteral">&#39;solution&#39;</span>],</div>
<div class="line">                <span class="stringliteral">&#39;status&#39;</span> =&gt; 1,</div>
<div class="line">                <span class="stringliteral">&#39;notified&#39;</span> =&gt; 0</div>
<div class="line">        );</div>
<div class="line">        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Saved.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;task solve&#39;</span>, $wid);</div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;editSolution&#39;</span>, array($wid, $tid));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ab8d5828db2f54803fb162dfdf44f15de"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditSolutionsGradeForm </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$uid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$tid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$submitted</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00530">530</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>,$USER,<a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $uid = intval($uid);</div>
<div class="line">        $tid = intval($tid);</div>
<div class="line">        $submitted = intval($submitted);</div>
<div class="line"></div>
<div class="line">        <a class="code" href="tasks_8php.html#a17b2ff0082f478470dc8ca4d28b6568f">checkUserCanEditTasks</a>($wid);</div>
<div class="line"></div>
<div class="line">        $DB-&gt;task_solutions($wid, $tid, $uid, $submitted)-&gt;update(array(</div>
<div class="line">                <span class="stringliteral">&#39;status&#39;</span> =&gt; intval($_POST[<span class="stringliteral">&#39;status&#39;</span>]),</div>
<div class="line">                <span class="stringliteral">&#39;grade&#39;</span> =&gt; $_POST[<span class="stringliteral">&#39;grade&#39;</span>],</div>
<div class="line">                <span class="stringliteral">&#39;feedback&#39;</span> =&gt; $_POST[<span class="stringliteral">&#39;feedback&#39;</span>],</div>
<div class="line">                <span class="stringliteral">&#39;notified&#39;</span> =&gt; 2</div>
<div class="line">        ));</div>
<div class="line">        $PAGE-&gt;addMessage(sprintf(_(<span class="stringliteral">&#39;Task %d graded.&#39;</span>), $tid), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;showTaskSolutions&#39;</span>, array($wid, $uid));</div>
<div class="line">        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;task grade&#39;</span>, $wid);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a1bb56aca229089027f3284499c75d35b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditTask </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$tid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$new</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00086">86</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>

<p>Referenced by <a class="el" href="tasks_8php_source.html#l00077">actionCreateTask()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $tid = intval($tid);</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers) || !<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h4&gt;&#39;</span>. $DB-&gt;workshops[$wid]-&gt;get(<span class="stringliteral">&#39;title&#39;</span>) .<span class="stringliteral">&#39;&lt;/h4&gt;&#39;</span>;</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>(<a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME        =&gt; TYPE;         tDESCRIPTION;</span></div>
<div class="line"><span class="stringliteral">                description =&gt; richtextarea; the task;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>));</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($new)</div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;title = _(<span class="stringliteral">&#39;New qualification task&#39;</span>);</div>
<div class="line">                $form-&gt;values = array(</div>
<div class="line">                        <span class="stringliteral">&#39;wid&#39;</span> =&gt; $wid,</div>
<div class="line">                        <span class="stringliteral">&#39;tid&#39;</span> =&gt; $tid,</div>
<div class="line">                        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;&#39;</span></div>
<div class="line">                );</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;title = _(<span class="stringliteral">&#39;Edit qualification task&#39;</span>);</div>
<div class="line">                $form-&gt;values = $DB-&gt;tasks($wid,$tid)-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;a class=&quot;back&quot; href=&quot;showWorkshopTasks(&#39;</span>. $wid .<span class="stringliteral">&#39;)&quot;&gt;&#39;</span> ._(<span class="stringliteral">&#39;back&#39;</span>) .<span class="stringliteral">&#39;&lt;/a&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (!$form-&gt;submitted())</div>
<div class="line">                <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">        <span class="keywordflow">if</span> (!$form-&gt;valid)</div>
<div class="line">                <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($new)</div>
<div class="line">                $DB-&gt;tasks[]= array(</div>
<div class="line">                        <span class="stringliteral">&#39;wid&#39;</span> =&gt; $wid,</div>
<div class="line">                        <span class="stringliteral">&#39;tid&#39;</span> =&gt; $tid,</div>
<div class="line">                        <span class="stringliteral">&#39;description&#39;</span> =&gt; $values[<span class="stringliteral">&#39;description&#39;</span>]</div>
<div class="line">                );</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">                $DB-&gt;tasks($wid,$tid)-&gt;update($values);</div>
<div class="line">        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;task edit&#39;</span>, $wid);</div>
<div class="line">        $PAGE-&gt;addMessage(<span class="stringliteral">&#39;Saved.&#39;</span>, <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;showWorkshopTasks&#39;</span>, array($wid));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ae7b40cdb225277c914608d27f4d75a2e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditTasksComment </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00401">401</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, $USER;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        <a class="code" href="tasks_8php.html#a17b2ff0082f478470dc8ca4d28b6568f">checkUserCanEditTasks</a>($wid);</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Comments concerning tasks&#39;</span>);</div>
<div class="line">        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME          =&gt; TYPE;         tDESCRIPTION;</span></div>
<div class="line"><span class="stringliteral">                tasks_comment =&gt; richtextarea;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;tasks_comment&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>] = _(</div>
<div class="line">                <span class="stringliteral">&#39;This is a place where you can add information concerning all tasks, how to &#39;</span>.</div>
<div class="line">                <span class="stringliteral">&#39;submit solutions, etc. You may, for example, attach a pdf with all the tasks. &#39;</span>.</div>
<div class="line">                <span class="stringliteral">&#39;If you won\&#39;t be able to check tasks during some period, write about it here.&#39;</span>);</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        $DB-&gt;workshops[$wid]-&gt;update($values);</div>
<div class="line">                        $PAGE-&gt;addMessage(<span class="stringliteral">&#39;Saved.&#39;</span>, <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;showWorkshopTasks&#39;</span>, array($wid));</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line">        $form-&gt;values = $DB-&gt;workshops[$wid]-&gt;assoc(<span class="stringliteral">&#39;tasks_comment&#39;</span>);</div>
<div class="line">        <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a2e198636405f0e355af142a92bb6c6d3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionShowPointsTable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00344">344</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Summary of points&#39;</span>);</div>
<div class="line">        $DB-&gt;query(<span class="stringliteral">&#39;SELECT wu.uid, wu.wid, wu.participant, wu.points, w.title, u.name</span></div>
<div class="line"><span class="stringliteral">                FROM table_workshops w, table_workshop_users wu, table_users u</span></div>
<div class="line"><span class="stringliteral">                WHERE wu.uid=u.uid AND w.edition=$1 AND wu.wid=w.wid AND wu.points IS NOT NULL</span></div>
<div class="line"><span class="stringliteral">                ORDER BY u.ordername, wu.wid&#39;</span>,</div>
<div class="line">                <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>));</div>
<div class="line">        $data = $DB-&gt;fetch_all();</div>
<div class="line">        <span class="keywordflow">if</span> (empty($data))</div>
<div class="line">                <span class="keywordflow">return</span> print _(<span class="stringliteral">&#39;No data (no one has been graded yet).&#39;</span>);</div>
<div class="line"></div>
<div class="line">        $dataByUid = array();</div>
<div class="line">        $titles = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($data as $row)</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> (!isset($dataByUid[$row[<span class="stringliteral">&#39;uid&#39;</span>]]) || !is_array($dataByUid[$row[<span class="stringliteral">&#39;uid&#39;</span>]]))</div>
<div class="line">                        $dataByUid[$row[<span class="stringliteral">&#39;uid&#39;</span>]] = array(<span class="stringliteral">&#39;points&#39;</span> =&gt; array(), <span class="stringliteral">&#39;name&#39;</span> =&gt; $row[<span class="stringliteral">&#39;name&#39;</span>]);</div>
<div class="line">                $dataByUid[$row[<span class="stringliteral">&#39;uid&#39;</span>]][<span class="stringliteral">&#39;points&#39;</span>][$row[<span class="stringliteral">&#39;wid&#39;</span>]]= $row[<span class="stringliteral">&#39;points&#39;</span>];</div>
<div class="line">                $titles[$row[<span class="stringliteral">&#39;wid&#39;</span>]] = $row[<span class="stringliteral">&#39;title&#39;</span>];</div>
<div class="line">        }</div>
<div class="line">        ksort($titles);</div>
<div class="line">        $wids = array_keys($titles);</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;table style=&quot;text-align: center&quot;&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;/th&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($wids as $wid)</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;th&gt;&lt;a &#39;</span>. <a class="code" href="template_8php.html#a9b9585537fe5238d4d5b54478251ccfa">getTipJS</a>($titles[$wid]) .<span class="charliteral">&#39;&gt;&#39;</span>. $wid .<span class="stringliteral">&#39;&lt;/th&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/thead&gt;&lt;tbody&gt;&#39;</span>;</div>
<div class="line">        $class = <span class="stringliteral">&#39;third&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($dataByUid as $uid =&gt; $user)</div>
<div class="line">        {</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;tr class=&quot;&#39;</span>. $class .<span class="stringliteral">&#39;&quot;&gt;&lt;td&gt;&#39;</span>. $user[<span class="stringliteral">&#39;name&#39;</span>] .<span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                $tdclass = <span class="stringliteral">&#39;third&#39;</span>;</div>
<div class="line">                <span class="keywordflow">foreach</span> ($wids as $wid)</div>
<div class="line">                {</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;td class=&quot;&#39;</span>. $tdclass .<span class="stringliteral">&#39;&quot;&gt;&#39;</span>;</div>
<div class="line">                        echo isset($user[<span class="stringliteral">&#39;points&#39;</span>][$wid]) ? $user[<span class="stringliteral">&#39;points&#39;</span>][$wid] : <span class="charliteral">&#39;-&#39;</span>;</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                        $tdclass = ($tdclass==<span class="stringliteral">&#39;even&#39;</span>)?<span class="stringliteral">&#39;odd&#39;</span>:(($tdclass==<span class="stringliteral">&#39;odd&#39;</span>)?<span class="stringliteral">&#39;third&#39;</span>:<span class="stringliteral">&#39;even&#39;</span>);</div>
<div class="line">                }</div>
<div class="line">                $class = ($class==<span class="stringliteral">&#39;even&#39;</span>)?<span class="stringliteral">&#39;odd&#39;</span>:(($class==<span class="stringliteral">&#39;odd&#39;</span>)?<span class="stringliteral">&#39;third&#39;</span>:<span class="stringliteral">&#39;even&#39;</span>);</div>
<div class="line">        }</div>
<div class="line">        <span class="comment">// A row to equalize column widths.</span></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;tr style=&quot;visibility: hidden&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($wids as $wid)</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;td&gt;0000&lt;/td&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/tr&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/tbody&gt;&lt;/table&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;#&lt;/th&gt;&lt;th&gt;&#39;</span>. _(<span class="stringliteral">&#39;title&#39;</span>) .<span class="stringliteral">&#39;&lt;/th&gt;&lt;/thead&gt;&lt;tbody&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($titles as $wid =&gt; $title)</div>
<div class="line">                echo <span class="stringliteral">&quot;&lt;tr&gt;&lt;td&gt;$wid&lt;/td&gt;&lt;td&gt;$title&lt;/td&gt;&lt;/tr&gt;&quot;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/tbody&gt;&lt;/table&gt;&#39;</span>;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="aca06f86abe442189d96a3f04ad123a8c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionShowTaskSolutions </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$uid</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00430">430</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $uid = intval($uid);</div>
<div class="line"></div>
<div class="line">        <a class="code" href="tasks_8php.html#a17b2ff0082f478470dc8ca4d28b6568f">checkUserCanEditTasks</a>($wid);</div>
<div class="line"></div>
<div class="line">        $statusOptions = <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>()-&gt;assoc(<span class="stringliteral">&#39;id&#39;</span>, <span class="stringliteral">&#39;description&#39;</span>);</div>
<div class="line">        $g = $DB-&gt;users[$uid]-&gt;get(<span class="stringliteral">&#39;gender&#39;</span>);</div>
<div class="line">        <span class="keywordflow">foreach</span> ($statusOptions as &amp;$option)</div>
<div class="line">                $option = <a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>($option, $g);</div>
<div class="line"></div>
<div class="line">        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME         =&gt; TYPE;     tDESCRIPTION;             VALIDATION;</span></div>
<div class="line"><span class="stringliteral">                participant  =&gt; select;   status;</span></div>
<div class="line"><span class="stringliteral">                points       =&gt; text;     points;                   int;</span></div>
<div class="line"><span class="stringliteral">                admincomment =&gt; textarea; a comment for admins only;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;points&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>] .= <span class="stringliteral">&#39; &lt;small&gt;(0..6)&lt;/small&gt;&#39;</span>;</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;participant&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = $statusOptions;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h3&gt;&#39;</span>. $DB-&gt;workshops[$wid]-&gt;get(<span class="stringliteral">&#39;title&#39;</span>) .<span class="stringliteral">&#39;&lt;/h3&gt;&#39;</span>;</div>
<div class="line">        echo <a class="code" href="user_2utils_8php.html#a29f037f468ee2716970ae6e7293644e2">getUserBadge</a>($uid, <span class="keyword">true</span>);</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        $DB-&gt;workshop_users($wid,$uid)-&gt;update($values);</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Saved.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;task qualify&#39;</span>, $wid);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line">        $form-&gt;values = $DB-&gt;workshop_users($wid,$uid)-&gt;assoc(<span class="stringliteral">&#39;participant,admincomment,points&#39;</span>);</div>
<div class="line"></div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Task solutions&#39;</span>);</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;a class=&quot;back&quot; href=&quot;showWorkshopTasks(&#39;</span>. $wid .<span class="stringliteral">&#39;)&quot;&gt;wróć&lt;/a&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h4&gt;&#39;</span>. _(<span class="stringliteral">&#39;Overall&#39;</span>) .<span class="stringliteral">&#39;&lt;/h4&gt;&#39;</span>;</div>
<div class="line">        echo $form-&gt;getHTML();</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $tasks = $DB-&gt;query(<span class="stringliteral">&#39;SELECT tid FROM table_tasks WHERE wid=$1 ORDER BY tid&#39;</span>, $wid);</div>
<div class="line">        <span class="keywordflow">foreach</span> ($tasks as $task)</div>
<div class="line">        {</div>
<div class="line">                $tid = $task[<span class="stringliteral">&#39;tid&#39;</span>];</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;h4&gt;&#39;</span>. _(<span class="stringliteral">&#39;Task&#39;</span>). <span class="charliteral">&#39; &#39;</span>. $tid .<span class="stringliteral">&#39;&lt;/h4&gt;&#39;</span>;</div>
<div class="line">                $DB-&gt;query(<span class="stringliteral">&#39;SELECT * FROM table_task_solutions</span></div>
<div class="line"><span class="stringliteral">                            WHERE wid=$1 AND tid=$2 AND uid=$3 ORDER BY submitted DESC LIMIT 4&#39;</span>,</div>
<div class="line">                        $wid, $tid, $uid);</div>
<div class="line">                $sols = $DB-&gt;fetch_all();</div>
<div class="line">                <span class="keywordflow">if</span> (empty($sols))</div>
<div class="line">                        echo _(<span class="stringliteral">&#39;No solution.&#39;</span>);</div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                {</div>
<div class="line">                        $sol = array_shift($sols);</div>
<div class="line">                        echo _(<span class="stringliteral">&#39;submitted&#39;</span>) .<span class="stringliteral">&#39;: &#39;</span>. strftime(<span class="stringliteral">&quot;%F %T&quot;</span>, $sol[<span class="stringliteral">&#39;submitted&#39;</span>]);</div>
<div class="line">                        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                                NAME     =&gt; TYPE;     tDESCRIPTION;</span></div>
<div class="line"><span class="stringliteral">                                status   =&gt; select;   status;</span></div>
<div class="line"><span class="stringliteral">                                grade    =&gt; text;     grade;</span></div>
<div class="line"><span class="stringliteral">                                feedback =&gt; textarea; feedback;</span></div>
<div class="line"><span class="stringliteral">                        &#39;</span>);</div>
<div class="line">                        $inputs[<span class="stringliteral">&#39;status&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = <a class="code" href="enum_8php.html#a62e36e012cad3e20e64476d4dd81bcd2">enumSolutionStatus</a>()-&gt;assoc(<span class="stringliteral">&#39;id&#39;</span>,<span class="stringliteral">&#39;description&#39;</span>);</div>
<div class="line">                        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line">                        $form-&gt;action = <span class="stringliteral">&quot;editSolutionsGradeForm($wid;$uid;$tid;&quot;</span>. $sol[<span class="stringliteral">&#39;submitted&#39;</span>] .<span class="stringliteral">&quot;)&quot;</span>;</div>
<div class="line">                        $form-&gt;values = $sol;</div>
<div class="line"></div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;div class=&quot;descriptionBox&quot;&gt;&#39;</span>;</div>
<div class="line">                        echo <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($sol[<span class="stringliteral">&#39;solution&#39;</span>]);</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;/div&gt;&#39;</span>;</div>
<div class="line">                        echo $form-&gt;getHTML();</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">                        <span class="keywordflow">if</span> (!empty($sols))</div>
<div class="line">                        {</div>
<div class="line">                                <span class="comment">// We could write (instead of display:none)</span></div>
<div class="line">                                <span class="comment">// $PAGE-&gt;jsOnLoad .= &#39;$(&quot;#task&#39;. $tid .&#39;oldsols&quot;).hide();&#39;;</span></div>
<div class="line">                                <span class="comment">// but it would flicker at page load. So now javascript-disabled</span></div>
<div class="line">                                <span class="comment">// browsers can&#39;t see old solutions.</span></div>
<div class="line">                                echo <span class="stringliteral">&#39;&lt;a onclick=&quot;$(\&#39;#oldsols&#39;</span>. $tid .<span class="charliteral">&#39;\&#39;</span>).toggle(400);<span class="stringliteral">&quot; style=&quot;</span>cursor:pointer;<span class="stringliteral">&quot;&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                echo &#39;+ &#39;. _(&#39;older solutions&#39;) .&#39;&lt;/a&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                echo &#39;&lt;div id=&quot;</span>oldsols<span class="stringliteral">&#39;. $tid .&#39;</span><span class="stringliteral">&quot; style=&quot;</span>display:none<span class="stringliteral">&quot;&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                foreach ($sols as $sol)</span></div>
<div class="line"><span class="stringliteral">                                {</span></div>
<div class="line"><span class="stringliteral">                                        echo _(&#39;submitted&#39;). &#39;: &#39;. strftime(&quot;</span>%F %T<span class="stringliteral">&quot;, $sol[&#39;submitted&#39;]) .&#39;&lt;br/&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                        //echo &#39;status: &#39;. enumSolutionStatuses($sol[&#39;status&#39;])-&gt;description .&#39;&lt;br/&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                        if (!empty($sol[&#39;grade&#39;]))</span></div>
<div class="line"><span class="stringliteral">                                                echo _(&#39;grade&#39;) .&#39;: &#39;. htmlspecialchars($sol[&#39;grade&#39;]) .&#39;&lt;br/&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                        echo &#39;&lt;div class=&quot;</span>descriptionBox<span class="stringliteral">&quot;&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                        echo parseUserHTML($sol[&#39;solution&#39;]);</span></div>
<div class="line"><span class="stringliteral">                                        echo &#39;&lt;/div&gt;&lt;br/&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                                }</span></div>
<div class="line"><span class="stringliteral">                                echo &#39;&lt;/div&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">                        }</span></div>
<div class="line"><span class="stringliteral">                }</span></div>
<div class="line"><span class="stringliteral">                echo &#39;&lt;br/&gt;&lt;br/&gt;&#39;;</span></div>
<div class="line"><span class="stringliteral">        }</span></div>
<div class="line"><span class="stringliteral">}</span></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ae1f5d73a5ddf78d15aa18706f9786b14"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">buildParticipantList </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00248">248</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00339">actionShowWorkshopTasks()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        <span class="comment">//parses POST data with points, status and comments</span></div>
<div class="line">        <span class="keywordflow">foreach</span>($_POST[<span class="stringliteral">&#39;data&#39;</span>] as $userId =&gt; $row)</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> ($row[<span class="stringliteral">&#39;points&#39;</span>] == <span class="stringliteral">&#39;&#39;</span>)</div>
<div class="line">                        $row[<span class="stringliteral">&#39;points&#39;</span>] = <span class="stringliteral">&#39;NULL&#39;</span>;</div>
<div class="line"></div>
<div class="line">                $DB-&gt;query(<span class="stringliteral">&#39;UPDATE w1_workshop_users SET points=&#39;</span> . $row[<span class="stringliteral">&#39;points&#39;</span>] . <span class="stringliteral">&#39; WHERE wid=&#39;</span> . $wid . <span class="stringliteral">&#39; AND uid=&#39;</span> .$userId); </div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $template = <span class="keyword">new</span> <a class="code" href="classSimpleTemplate.html">SimpleTemplate</a>();</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        $DB-&gt;query(<span class="stringliteral">&#39;SELECT wu.uid, wu.participant, wu.points, u.gender</span></div>
<div class="line"><span class="stringliteral">                FROM table_workshop_users wu, table_users u</span></div>
<div class="line"><span class="stringliteral">                WHERE wu.uid=u.uid AND wu.wid=$1 AND wu.participant&gt;0</span></div>
<div class="line"><span class="stringliteral">                ORDER BY u.ordername, u.uid&#39;</span>, $wid);</div>
<div class="line">        $participants = $DB-&gt;fetch_all();</div>
<div class="line"></div>
<div class="line">        $DB-&gt;query(<span class="stringliteral">&#39;SELECT tid FROM table_tasks WHERE wid=$1 ORDER BY tid&#39;</span>, $wid);</div>
<div class="line">        $tasks = $DB-&gt;fetch_column();</div>
<div class="line"></div>
<div class="line">        $counts = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> (<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>() as $statusName =&gt; $status)</div>
<div class="line">                $counts[$status-&gt;id] = 0;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($participants as $participant)</div>
<div class="line">                $counts[$participant[<span class="stringliteral">&#39;participant&#39;</span>]]++;</div>
<div class="line">        $countDescription = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> (<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>() as $statusName =&gt; $status)</div>
<div class="line">                <span class="keywordflow">if</span> ($statusName != <span class="stringliteral">&#39;none&#39;</span> || $counts[$status-&gt;id])</div>
<div class="line">                $countDescription[]= <a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>($status-&gt;description, <span class="charliteral">&#39;p&#39;</span>) .<span class="stringliteral">&#39;: &#39;</span>. $counts[$status-&gt;id]; <span class="comment">// TODO i18n polish plural -ych</span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h3 style=&quot;display:inline-block&quot;&gt;&#39;</span>. _(<span class="stringliteral">&#39;Signups&#39;</span>) .<span class="stringliteral">&#39;&lt;/h3&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;table class=&quot;right&quot;&gt;&lt;tr&gt;&lt;td&gt;&#39;</span>. implode(<span class="stringliteral">&#39;&lt;/td&gt;&lt;td&gt;&#39;</span>, $countDescription) .<span class="stringliteral">&#39;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;form action=&quot;showWorkshopTasks(&#39;</span> . $wid . <span class="stringliteral">&#39;)&quot; method=&quot;post&quot;&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;table style=&quot;border-top: 1px black solid&quot;&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&#39;</span>. _(<span class="stringliteral">&#39;participant&#39;</span>) .<span class="stringliteral">&#39;&lt;/th&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($tasks as $tid)  echo <span class="stringliteral">&quot;&lt;th&gt;$tid&lt;/th&gt;&quot;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;th&gt;&#39;</span>. _(<span class="stringliteral">&#39;points&#39;</span>) .<span class="stringliteral">&#39; (0..6)&lt;/th&gt;&lt;th&gt;&#39;</span>. _(<span class="stringliteral">&#39;overall&#39;</span>) .<span class="stringliteral">&#39;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&#39;</span>;</div>
<div class="line">        $staff = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($participants as $participant)</div>
<div class="line">        {</div>
<div class="line">                $uid = $participant[<span class="stringliteral">&#39;uid&#39;</span>];</div>
<div class="line">                $status = $participant[<span class="stringliteral">&#39;participant&#39;</span>];</div>
<div class="line">                <span class="keywordflow">if</span> ($status == <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;lecturer&#39;</span>)-&gt;<span class="keywordtype">id</span>)</div>
<div class="line">                        ; <span class="comment">// Do nothing.</span></div>
<div class="line">                <span class="keywordflow">else</span> <span class="keywordflow">if</span> ($status == <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;autoaccepted&#39;</span>)-&gt;<span class="keywordtype">id</span>)</div>
<div class="line">                                $staff[$uid]= <a class="code" href="user_2utils_8php.html#a29f037f468ee2716970ae6e7293644e2">getUserBadge</a>($uid);</div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                {</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;tr class=&quot;&#39;</span>. <a class="code" href="template_8php.html#a37d777a190ddf72ef569a520257dd64d">alternate</a>(<span class="stringliteral">&#39;even&#39;</span>, <span class="stringliteral">&#39;odd&#39;</span>) .<span class="stringliteral">&#39;&quot;&gt;&#39;</span>;</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;td&gt;&#39;</span>. <a class="code" href="user_2utils_8php.html#a29f037f468ee2716970ae6e7293644e2">getUserBadge</a>($uid, <span class="keyword">true</span>) .<span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                        <span class="comment">// Get latest solutions (solutions submitted later overwrite earlier ones).</span></div>
<div class="line">                        $r = $DB-&gt;query(<span class="stringliteral">&#39;SELECT tid,status FROM table_task_solutions</span></div>
<div class="line"><span class="stringliteral">                                WHERE wid=$1 AND uid=$2 ORDER BY tid, submitted ASC&#39;</span>, $wid, $uid);</div>
<div class="line">                        $solutions = array();</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($tasks as $tid)  $solutions[$tid] = <a class="code" href="enum_8php.html#a62e36e012cad3e20e64476d4dd81bcd2">enumSolutionStatus</a>(<span class="stringliteral">&#39;none&#39;</span>)-&gt;id;</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($r as $solution)  $solutions[$solution[<span class="stringliteral">&#39;tid&#39;</span>]] = $solution[<span class="stringliteral">&#39;status&#39;</span>];</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($tasks as $tid)</div>
<div class="line">                        {</div>
<div class="line">                                $s = <a class="code" href="enum_8php.html#a62e36e012cad3e20e64476d4dd81bcd2">enumSolutionStatus</a>($solutions[$tid]);</div>
<div class="line">                                echo <span class="stringliteral">&#39;&lt;td&gt;&#39;</span>. <a class="code" href="template_8php.html#a4fbd311bbd72b7beba6f27fe63b0acb1">getIcon</a>($s-&gt;icon, $s-&gt;description) .<span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                        }</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;td&gt;&#39;</span> . <span class="stringliteral">&#39;&lt;select name=&quot;data[&#39;</span>. $uid .<span class="stringliteral">&#39;][points]&quot;&gt;&#39;</span>;</div>
<div class="line">                        $points = array(<span class="stringliteral">&#39;&#39;</span>, 0, 1, 2, 3, 4, 5, 6);</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($points as $i)</div>
<div class="line">                        {</div>
<div class="line">                                <span class="keywordflow">if</span> ($i == $participant[<span class="stringliteral">&#39;points&#39;</span>] &amp;&amp; $participant[<span class="stringliteral">&#39;points&#39;</span>] != <span class="stringliteral">&#39;&#39;</span>)</div>
<div class="line">                                {</div>
<div class="line">                                        echo <span class="stringliteral">&#39;&lt;option selected value=&quot;&#39;</span> . $i . <span class="stringliteral">&#39;&quot;&gt;&#39;</span> . $i . <span class="stringliteral">&#39;&lt;/option&gt;&#39;</span>;</div>
<div class="line">                                }</div>
<div class="line">                                <span class="keywordflow">else</span> </div>
<div class="line">                                {</div>
<div class="line">                                        echo <span class="stringliteral">&#39;&lt;option value=&quot;&#39;</span> . $i . <span class="stringliteral">&#39;&quot;&gt;&#39;</span> . $i . <span class="stringliteral">&#39;&lt;/option&gt;&#39;</span>;</div>
<div class="line">                                }</div>
<div class="line">                        }</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;/select&gt;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                        $desc = <a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>(<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>($status)-&gt;description, $participant[<span class="stringliteral">&#39;gender&#39;</span>]);</div>
<div class="line">                        $icon = <a class="code" href="template_8php.html#a4fbd311bbd72b7beba6f27fe63b0acb1">getIcon</a>(<span class="stringliteral">&#39;arrow-right.png&#39;</span>,      _(<span class="stringliteral">&#39;see &amp; grade solutions&#39;</span>), <span class="stringliteral">&quot;showTaskSolutions($wid;$uid)&quot;</span>);</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;td&gt;&#39;</span>. $desc;</div>
<div class="line">                        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers))</div>
<div class="line">                                echo <span class="stringliteral">&#39;&lt;span class=&quot;right&quot;&gt;&#39;</span>. $icon . <span class="stringliteral">&#39;&lt;/span&gt;&#39;</span>;</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;/td&gt;&lt;/tr&gt;&#39;</span>;</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/tbody&gt;&lt;/table&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;input type=&quot;submit&quot; value=&quot;&#39;</span> . _(<span class="stringliteral">&#39;save&#39;</span>) . <span class="stringliteral">&#39;&quot;/&gt;&lt;/form&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (!empty($staff))</div>
<div class="line">                echo _(<span class="stringliteral">&#39;from staff: &#39;</span>). implode(<span class="stringliteral">&#39;, &#39;</span>, $staff) . <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">return</span> $template-&gt;finish();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a5330df836d593c05befda9913a6acc23"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">buildTaskList </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00009">9</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00339">actionShowWorkshopTasks()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line"></div>
<div class="line">        $template = <span class="keyword">new</span> <a class="code" href="classSimpleTemplate.html">SimpleTemplate</a>();</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h3&gt;&#39;</span>. _(<span class="stringliteral">&#39;Qualification tasks&#39;</span>) .<span class="stringliteral">&#39;&lt;/h3&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $taskComment = $DB-&gt;workshops[$wid]-&gt;get(<span class="stringliteral">&#39;tasks_comment&#39;</span>);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers) &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">        {</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;span class=&quot;right&quot;&gt;&#39;</span>;</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;a &#39;</span>.</div>
<div class="line">                        <a class="code" href="template_8php.html#a9b9585537fe5238d4d5b54478251ccfa">getTipJS</a>(_(<span class="stringliteral">&#39;This is a place where you can add information concerning all tasks, how to &#39;</span>.</div>
<div class="line">                                <span class="stringliteral">&#39;submit solutions, etc. You may, for example, attach a pdf with all the tasks. &#39;</span>.</div>
<div class="line">                                <span class="stringliteral">&#39;If you won\&#39;t be able to check tasks during some period, write about it here.&#39;</span>));</div>
<div class="line">                echo <span class="stringliteral">&#39;&gt;[?]&lt;/a&gt; &#39;</span>;</div>
<div class="line">                echo <a class="code" href="template_8php.html#a4fbd311bbd72b7beba6f27fe63b0acb1">getIcon</a>(<span class="stringliteral">&#39;pencil.png&#39;</span>, _(<span class="stringliteral">&#39;edit&#39;</span>), <span class="stringliteral">&quot;editTasksComment($wid)&quot;</span>);</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;/span&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;div class=&quot;descriptionBox&quot;&gt;&#39;</span>. <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($taskComment) .<span class="stringliteral">&#39;&lt;/div&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $participant = $DB-&gt;workshop_users($wid, $USER[<span class="stringliteral">&#39;uid&#39;</span>])-&gt;get(<span class="stringliteral">&#39;participant&#39;</span>);</div>
<div class="line">        $participant = <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(intval($participant));</div>
<div class="line">        $isParticipant = $participant-&gt;inArray(<span class="stringliteral">&#39;candidate&#39;</span>, <span class="stringliteral">&#39;accepted&#39;</span>, <span class="stringliteral">&#39;rejected&#39;</span>);</div>
<div class="line"></div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;div class=&quot;tableWrapper&quot;&gt;&lt;table class=&quot;tasks&quot;&gt;&#39;</span>;</div>
<div class="line">        $tasks = $DB-&gt;query(<span class="stringliteral">&#39;SELECT * FROM table_tasks WHERE wid=$1 ORDER BY tid&#39;</span>, $wid);</div>
<div class="line">        <span class="keywordflow">foreach</span> ($tasks as $task)</div>
<div class="line">        {</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;tr class=&quot;&#39;</span>. <a class="code" href="template_8php.html#a37d777a190ddf72ef569a520257dd64d">alternate</a>(<span class="stringliteral">&#39;even&#39;</span>,<span class="stringliteral">&#39;odd&#39;</span>) .<span class="stringliteral">&#39;&quot;&gt;&lt;td&gt;&#39;</span>. $task[<span class="stringliteral">&#39;tid&#39;</span>] .<span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;td&gt;&#39;</span>. <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($task[<span class="stringliteral">&#39;description&#39;</span>]) .<span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                $params = <span class="charliteral">&#39;(&#39;</span>. $wid .<span class="charliteral">&#39;;&#39;</span>. $task[<span class="stringliteral">&#39;tid&#39;</span>] .<span class="charliteral">&#39;)&#39;</span>;</div>
<div class="line">                <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers) &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                {</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;td&gt;&#39;</span>;</div>
<div class="line">                        echo <a class="code" href="template_8php.html#a4fbd311bbd72b7beba6f27fe63b0acb1">getIcon</a>(<span class="stringliteral">&#39;plugin-edit.png&#39;</span>, _(<span class="stringliteral">&#39;edit task&#39;</span>), <span class="stringliteral">&#39;editTask&#39;</span>. $params);</div>
<div class="line">                        echo <a class="code" href="template_8php.html#a4fbd311bbd72b7beba6f27fe63b0acb1">getIcon</a>(<span class="stringliteral">&#39;plugin-delete.png&#39;</span>, _(<span class="stringliteral">&#39;delete task&#39;</span>), <span class="stringliteral">&#39;deleteTask&#39;</span>. $params);</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                }</div>
<div class="line">                <span class="keywordflow">if</span> ($isParticipant &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;sendTaskSolution&#39;</span>))</div>
<div class="line">                {</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;td&gt;&#39;</span>;</div>
<div class="line">                        $DB-&gt;query(<span class="stringliteral">&#39;SELECT status, grade FROM table_task_solutions</span></div>
<div class="line"><span class="stringliteral">                                WHERE wid=$1 AND uid=$2 AND tid=$3</span></div>
<div class="line"><span class="stringliteral">                                ORDER BY submitted DESC LIMIT 1&#39;</span>,</div>
<div class="line">                                $wid, $USER[<span class="stringliteral">&#39;uid&#39;</span>], $task[<span class="stringliteral">&#39;tid&#39;</span>]);</div>
<div class="line">                        $sol = $DB-&gt;fetch_assoc();</div>
<div class="line"></div>
<div class="line">                        <span class="keywordflow">if</span> ($sol === <span class="keyword">false</span>)  echo _(<span class="stringliteral">&#39;submit&#39;</span>);</div>
<div class="line">                        <span class="keywordflow">else</span>  echo EnumSolutionStatus($sol[<span class="stringliteral">&#39;status&#39;</span>])-&gt;description;</div>
<div class="line">                        echo <span class="charliteral">&#39; &#39;</span>;</div>
<div class="line">                        echo <a class="code" href="template_8php.html#a4fbd311bbd72b7beba6f27fe63b0acb1">getIcon</a>(<span class="stringliteral">&#39;arrow-right.png&#39;</span>, _(<span class="stringliteral">&#39;your solution&#39;</span>), <span class="stringliteral">&#39;editSolution&#39;</span>. $params);</div>
<div class="line">                        echo <span class="stringliteral">&#39;&lt;/td&gt;&#39;</span>;</div>
<div class="line">                }</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;/tr&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers) &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&#39;</span>.</div>
<div class="line">                        <a class="code" href="template_8php.html#a93f1d2b73c6defc9f0af8e7e17b0b47d">getButton</a>(_(<span class="stringliteral">&#39;add a task&#39;</span>), <span class="stringliteral">&quot;createTask($wid)&quot;</span>, <span class="stringliteral">&#39;plugin-add.png&#39;</span>).</div>
<div class="line">                        <span class="stringliteral">&#39;&lt;/td&gt;&lt;/tr&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;/table&gt;&lt;/div&gt;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers) &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;i&gt;&#39;</span>. _(<span class="stringliteral">&#39;Your workshops await acceptance.&#39;</span>) .<span class="stringliteral">&#39;&lt;/i&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">return</span> $template-&gt;finish();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a17b2ff0082f478470dc8ca4d28b6568f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">checkUserCanEditTasks </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="tasks_8php_source.html#l00551">551</a> of file <a class="el" href="tasks_8php_source.html">tasks.php</a>.</p>

<p>Referenced by <a class="el" href="tasks_8php_source.html#l00401">actionEditTasksComment()</a>, and <a class="el" href="tasks_8php_source.html#l00430">actionShowTaskSolutions()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editTasks&#39;</span>, $lecturers) || !<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 8 2013 17:44:57 for wwwApp by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>
